#ifndef GRIDHELPER_H
#define GRIDHELPER_H

#include "gui/helper.h"


namespace gui
{
    /**
    *   Grid Helper
    */

	class GridHelper: public Helper
	{

	public:
		GridHelper(GraphicView& graphicview);
		virtual ~GridHelper();

		/**
		* @return Array of all visible grid points.
		*/
		const std::vector<Vector>& getPoints()const
		{
			return pt;
		}
		/**
		* @return Meta grid positions in X.
		*/
		const std::vector<double>& getMetaX()const
		{
			return metaX;
		}
		/**
		* @return Meta grid positions in Y.
		*/
		const std::vector<double>& getMetaY()const
		{
			return metaX;
		}


		void rebuild(int minGridSpacing=10, Vector userGrid=Vector(-1.0, -1.0), bool autoscale=true);


	protected:
		void clear();

	private:

		//! Current grid spacing
		double spacing;
		//! Current meta grid spacing
		double metaSpacing;

		//! Pointer to array of grid points
		std::vector<Vector> pt;

		//! Meta grid positions in X
		std::vector<double> metaX;

		//! Meta grid positions in Y
		std::vector<double> metaY;

	};

}

#endif // GRIDHELPER_H
